﻿#include <iostream>
#include <vector>
using namespace std;

int dir[4][2] = { {1,0} ,{-1,0} ,{0,1} ,{0,-1} };

bool solve(vector<string>& _map, int x, int y, string& data, int k) {
	if (k == data.size()) return true;
	int cow, row;
	for (int i = 0; i < 4; i++) {
		cow = x + dir[i][0], row = y + dir[i][1];
		if (data[k] == _map[x][y] && cow >= 0 && cow < _map.size() && row <= _map[0].size() && row >= 0) {
			if (solve(_map, cow, row, data, k + 1)) return true;
		}
	}
	return false;
}

int main() {
	vector<string> _map; int n; cin >> n;
	for (int i = 0; i < n; i++) {
		string a; cin >> a; _map.push_back(a);
	}
	string data;
	cin >> data;
	for (int i = 0; i < _map.size(); i++) {
		for (int j = 0; j < _map[0].size(); j++) {
			if (solve(_map, i, j, data, 0)) {
				cout << "yes" << endl; return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}